// src/store/sagas/article.saga.js
import { takeEvery, put } from 'redux-saga/effects'
import axios from 'axios'

function * loadArticles({ offset, limit }) {
    let { data } = yield axios.get("/articles", {
        params: { offset, limit }
    })
    yield put({
        type: 'loadArticlesSuccess', 
        payload: data.articles
    })
}

export default function * articleSaga () {
    yield takeEvery('loadArticles', loadArticles)
}